/*
2021-6-29
 https://ac.nowcoder.com/acm/problem/15032
*/

#include<iostream>
#include<cstring>
#include<algorithm>

using namespace std;
int q[105];

int main()
{
    int n;
    cin>>n;
    int len=0;
    while(n--)
    {
        int x;
        cin>>x;
        int l=0,r=len;
        while(l<r)
        {
            int mid=(l+r+1)>>1;
            if(x>=q[mid]) l=mid;
            else r=mid-1;
        }
        len=max(r+1,len);
        q[r+1]=x;
    }
    if(len>=30) puts("yes");
    else puts("no");
    return 0;
}






